Methods and apparatus for smoothing text outlines

ABSTRACT

Methods and apparatus are provided to smooth a jagged outline of a reconstructed text generated through any of a variety of systems, such as, for example, an image scanner. Given the reconstructed text with a jagged outline, the methods smooth the outline of the text first through location of horizontal and vertical edges, and subsequent gray scale reconstruction of the edge ink level from a one-bit or a low number of bits edge pattern. The methods then provide identification of the local text outline pattern and corresponding ink level adjustment of the center pixel. The methods produce text having very smooth horizontal and vertical edges. The methods then smooth slanted edges, mend holes in the text, and remove isolated pixels of ink.

REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. application Ser. No. 10/317,470, filed 11 Dec. 2002, now U.S. Pat. No. 6,885,477, which is a continuation of U.S. application Ser. No. 09/721,404, filed 21 Nov. 2000, now U.S. Pat. No. 6,501,565, which is a continuation-in-part of U.S. application Ser. No. 09/111,633, filed 7 Jul. 1998, now U.S. Pat. No. 6,310,697.

FIELD OF THE INVENTION

The present invention relates to image text smoothing. More particularly, the present invention relates to a method and apparatus for producing text images with improved smoothness in horizontal, vertical, and slanted edges, and for hole mending and dot removal.

BACKGROUND OF THE INVENTION

Text or pictorial images are often replicated or transmitted by a variety of techniques, such as photocopying, facsimile transmission, and scanning images into a memory device. The process of replication or transmission often tends to degrade the resulting image due to a variety of factors. Degraded images are characterized by indistinct or shifted edges, blended or otherwise connected characters and distorted shapes.

A reproduced or transmitted image that is degraded in quality may be unusable in certain applications. For example, if the reproduced or transmitted image is to be used in conjunction with a character recognition apparatus, the indistinct edges, connected characters, etc. may preclude accurate or successful recognition of characters in the image. Also, if the degraded image is printed or otherwise rendered visible, the image may be more difficult to read and less pleasing to the eye.

There are several approaches to improve image quality. A classical resolution enhancement algorithm for example, is template matching. Template matching attempts to match a line, curve pattern, or linear pattern and then tries to find the best way to reconstruct it with the printing resolution. However, after an image has been reconstructed using an enhancement technique, jagged outlines, holes, and undesired dots may still occur in the resulting reconstructed image. It is desirable to smooth these unwanted jagged outlines, and to eliminate unwanted holes and dots.

The prior art teaches smoothing techniques only for corners and diagonals. Also, the prior art assumes one-bit input. The prior art typically has been used within or in conjunction with rescaling processes.

Yamashita et al. U.S. Pat. No. 5,559,530 (“Yamashita”) discloses an image processing apparatus that comprises a font ROM for storing binary font data, and that generates a font with contour lines expressed with gradations. An output port is provided for reading a target pixel with ambient pixels arranged in a 3×3 matrix of the binary font data stored in the font ROM. A shift register produces address data based on the binary data read from the font ROM. A look-up table has 2^(3×3) elements in which multilevel values are commensurate with the pixel patterns included in the 3×3 matrix. One datum of the multilevel data is output from the look-up table by designating one element by the address data, and is used as gradation data of the target pixel. Thus, the font pixel can be expressed with a gradation and the jagged contour of the font is reduced.

Yamashita assumes smoothing bit-map image data. That is, Yamashita teaches generating multilevel data values from bit-map image data values wherein the bit-map image data values correspond to respective pixels. Each of the pixels has a respective binary level and includes four sub-areas, each of which correspond to a respective sub-pixel. Also, Yamashita teaches a conversion table having 2^(3×3) elements, wherein each element includes a set of density data values that are arranged in a 2×2 matrix and in a predetermined order. The density data values are calculated from the percentage of the black area of a sub-area of each of the sub-pixels, wherein the area is based on one or more main contour lines which is predicted from the positions of black pixels in the matrix-shaped area, and the sub-pixels, being 2×2 sub-divisions of the pixel area of the target pixel.

Zeng European Patent Application EP 0 719 034 A1 (“Zeng”) discloses a scanner/printer system for smoothing the edges of text or line art. The system includes a copy board for an image bearing an original, a CCD, a PCI bus, a processor which uses edge smooth software and a laser printer. The edge smooth software adds variable size fill-in patterns of pixels to the image data scanned by the CCD at low resolution to smooth the edges of text or line art prior to printing at high resolution. Zeng teaches smoothing curves and diagonals, and smoothing many different sizes of corners and chinks, and using one-bit printing. Zeng requires orientation estimation for many different angles.

It would be advantageous to provide methods and apparatus that minimize the modification of data, that is, as faithfully to the original input as possible.

It would be advantageous to provide methods and apparatus that recognize and handle outliers or degraded, jaggy or otherwise corrupt original data, especially with respect to vertical and horizontal edges.

It would be advantageous to provide methods and apparatus that recognize and handle outliers or degraded, jaggy, or otherwise corrupt original data from non-ideal source inputs, such as, for example half-tone text edges or scanned text.

It would be advantageous to provide methods and apparatus that are fast, simple, and flexible.

It would be advantageous to provide methods and apparatus that provide general enhancements comprising, for example, hole-filling, isolated dot removal, and anti-aliasing.

It would be advantageous to provide conversion tables that are organized by jaggy levels with a preference for minimal change. That is, jaggy level zero dominates.

It would be advantageous to provide conversion tables that provide a final output ink level for a center pixel as a function of its original ink level, and as a function of the surrounding ink and background pattern. Such a table provides substantially different output ink from other tables for a particular ink and background pattern, depending on the original center ink level.

It would be advantageous to provide conversion tables that are organized efficiently into distinct patterns using concepts of rotation, reflection, and complements.

SUMMARY OF THE INVENTION

Methods and apparatus are provided to smooth a jagged outline of reconstructed text generated through any of a variety of systems, such as, for example, an image scanner. Given the reconstructed text with a jagged outline, the methods smooth the outline of the text first through location of horizontal and vertical edges, and subsequent gray scale reconstruction of the edge ink level from a one-bit or a low number of bits edge pattern. The methods then provide identification of the local text outline pattern and corresponding ink level adjustment of the center pixel. The methods produce text having very smooth horizontal and vertical edges. The methods then smooth slanted edges, mend holes in the text, and remove isolated pixels of ink.

BRIEF DESCRIPTION OF THE DRAWINGS

The above-mentioned objects and features of the present invention can be more clearly understood from the following detailed description considered in conjunction with the following drawings, in which the same reference numerals denote the same elements throughout, and in which:

FIG. 1 is a flow diagram of an application of a preferred embodiment of the invention;

FIG. 1 a is a diagram of associated devices for FIG. 1;

FIG. 1 b is a flow diagram of an application of a preferred embodiment of the invention;

FIG. 2 is a diagram of a text outline according to the invention;

FIG. 3 is a flow diagram of a method according to the invention;

FIG. 4 is a flow diagram of a first main procedure according to the invention; and

FIG. 5 is a flow diagram of a second main procedure according to the invention.

DETAILED DESCRIPTION OF THE INVENTION

Methods and apparatus are provided to smooth a jagged outline of reconstructed text generated through any of a variety of systems, such as, for example, an image scanner. Given the reconstructed text with a jagged outline, the methods smooth the outline of the text first through location of horizontal and vertical edges, and subsequent gray scale reconstruction of the edge ink level from a one-bit or a low number of bits edge pattern. The methods then provide identification of the local text outline pattern and corresponding ink level adjustment of the center pixel. The methods produce text having very smooth horizontal and vertical edges. The methods then smooth slanted edges, mend holes in the text, and remove isolated pixels of ink.

Smoothing Text Outlines

This invention may be used to smooth the jagged outline of text generated through text-enhancement methods. An exemplary text enhancement system is described below for the convenience of the reader. It should be appreciated that the claimed invention herein is by no means limited to using that text enhancement system. Furthermore, it is noted that the invention can work with other text enhancement methods, or even without a text enhancement method. However, in either case, the text in the claimed invention herein is required to have dark contour around it.

The Text Enhancement System.

The text enhancement systems described herein comprise easy to use page processing systems that enhance text on a digitally scanned page, thereby improve the crispness, clarity, and readability of the text. In addition, text enhancement systems in accordance with this invention are independent of the type of scanner used and utilize an ink redistribution system that increases the contrast of digitally scanned text or facsimiles.

A preferred embodiment of text enhancement systems in accordance with this invention provides a general purpose method for text enhancement that is independent of the type of scanner that is used to scan a document or the device printing the document. It is tolerant of the artifacts and defects that the scanning process introduces on the text, mainly blurring. The text enhancement system is ideal for image reconstruction systems for scanned or digitized images that are not synthetic, i.e., the image is not a result of any PostScript or Page Description Language (“PDL”) processing.

Typically, a page is scanned and a digitized image is obtained that is usually in an RGB format. If no specific enhancement procedures are applied to the text in the document, then the result is text that is not crisp, clear, or sharp and is therefore harder to read and less pleasant to the eyes.

Text enhancement systems in accordance with this invention preserve the amount of ink on the textual part of the page using a consistent method. The text is reconstructed through the reallocation of ink. There is a correspondence between the original amount of ink on the document and the intensity of the ink that the scanner read. The correspondence is either the same or there is some scaling factor involved. The factor is obtained by the fact that there is some overlap between two scanned pixels. The factor is also independent of the location of the pixels.

The new textual image is reconstructed where the same amount or a factor of the ink is preserved. Text has a centralization property. The ink is centralized, that is, there are rarely holes in groups of dark pixels. For example, there is a large white area surrounded by a black area in the letter “O” but it is not at the pixel level, it is at a multi-pixel level. If there are eight pixels that are black surrounding one pixel that is white, then it is likely that the white area is a misread by the scanner and there are actually nine pixels that are black. The ink on the page is arranged so that it is more centralized, more connected to other pixels that are dark.

A window of size W×W is constructed on a scanned page with the target pixel at the center of the window. The amount of ink in the window is calculated and the number of pixels that are darker than the center pixel is counted. The window is moved along the page and each pixel on the page has a chance to be the center of a window and be allocated ink. Text enhancement systems in accordance with this invention reallocate the amount of ink in full quantities of the darkest value. Only the center pixel will actually have its ink reallocated.

This reallocation is a key feature of the text enhancement systems described herein. First, attempt to allocate the ink pixel by pixel in the window. The darkest pixel gets ink, the second darkest gets ink, and so on, until there is no more ink remaining in the bank, where the initial amount of ink in the bank is equal to the total amount of ink in the window. If the center pixel is later in darkness and there is no ink left in the bank, then it will become white. If the center pixel is reached before the ink runs out, then it will become black. Only the reallocation to the center pixel becomes effective. The attempt to allocate ink to the other pixels in the window is only done to determine the center pixel's allocation. Those pixels are reallocated ink when they become the center of a current window. Text enhancement systems in accordance with this invention are not limited to black text on a white background, but also apply to grayscale, color, and white text on a black background.

For example, the amount of ink in a window is ten and the center pixel is the third darkest in the window. This means that only two other pixels in the window are darker than the center pixel. The text enhancement system cited herein reallocates the ink to the pixels. Given this example, it is desirable to have the center pixel black. If the amount of ink in the window were only three and the center pixel was sixth in darkness, then no ink would be put in the center pixel because reallocating the amount of ink in the window would not leave any for that pixel.

It is also noted that the claimed invention herein assumes the availability of multiple-bit printing. It can be applied to other jagged text outlines that resemble, but are not limited to, one-bit or low number of bits text reconstruction.

FIG. 1 is a flow diagram of an application of a preferred embodiment of the invention. A text image is scanned into a scanner 1. The text image is enhanced by a Text Enhancement System 2, which provides the enhanced image as input into the claimed invention, Smoothing Text Outlines 3. Smoothing Text Outlines 3 then smoothes the outlines of the text image according to the invention and provides the resulting image as input into a printer 4.

FIG. 1 a is a diagram of associated devices for FIG. 1. FIG. 1 a shows an embodiment of the claimed apparatus. The scanner 1 provides input to a computing device 5, comprising the Text Enhancement System 2, and the claimed invention, Smoothing Text Outlines 3. That is, residing in computing device 5 are means for locating horizontal and vertical edges of text images, means for smoothing the horizontal and vertical edges, means for locating slanted edges of the text images, and means for smoothing the slanted edges. Computing device 5 thus provides the output of the Smoothing Text Outlines 3 as input to printer 4. Computing devices can be, for example, stand-alone computers, image processing chips, and the like.

FIG. 1 b is a flow diagram of an illustrative application of a preferred embodiment of the invention. A document is scanned into a scanner 11. The pages of the scanned image are enhanced 12. The text of the enhanced image is smoothed according to the preferred embodiment of the invention 13. The smoothed image is faxed 14 to a desired destination and received 15 at the destination. It is appreciated that the claimed invention is not limited to scanner, printer, and fax devices, but can be used with a variety of utility devices.

FIG. 2 is a diagram of a text outline 10 of a typical text image, letter C 20 according to the invention. Given a reconstructed text with jagged outline, the preferred embodiment smoothes the outline of the text through two main separate procedures, as depicted in FIG. 3. The smoothing method starts 30 and invokes the first main procedure, identifying the precise location of horizontal and vertical edges and performing subsequent gray-scale reconstruction of the edge ink-level from an edge pattern 31. It is noted that the eye is more sensitive to text outline jaggedness in both the horizontal and vertical direction. The second procedure, identifying the local text outline pattern and corresponding ink-level adjustment of the center pixel 32, is subsequently invoked. Then the method ends 33.

Step 31 produces text with smooth horizontal and vertical edges. Step 32 smoothes slanted edges, i.e. similar to anti-aliasing, and also helps to mend holes in the text and remove isolated pixels of ink.

Horizontal and Vertical Edge Smoothing

In the preferred embodiment, at each pixel around a text outline we look at a 3×N neighborhood for horizontal edge detection and an N×3 neighborhood for vertical edge detection of the pixel. The Text Enhancement System cited herein identifies the text outline through a tag in the output. N is chosen to be seven (7). Other values for N can be used, but N=7 is chosen for the following reasons. First, N is chosen to be odd for obtaining symmetry. Then, if N is too small, it is less likely to be able to detect vertical and horizontal edges. If N is too large, then computation is increased unnecessarily because little or no improved performance is gained. N=5 is another value that can be used, but N=7 is found to be more robust. A threshold ink-level, T_(dark) is chosen such that any pixel darker than T_(dark) is considered part of the text while the rest of the pixels are consider part of the background. The precise value of T_(dark) is not very critical because it is assumed that the original text has sharp jagged outlines so that ink pixels and background pixels are easily distinguished.

According to the preferred embodiment, a horizontal edge is identified by the following condition. In a 3×N window, if the first row contains at least N-n ink pixels and the last row at least N-n background pixels or vice versa, where n is the number of outliers allowed, then the middle row is detected as the precise edge location, subject to the further condition that the outlying pixels cannot be directly above or below the center of the window. That is, outliers on the central column of the window are not permitted. In the preferred embodiment, N=7 and n=1. A vertical edge is identified similarly by using an N×3 window and by counting ink and background pixels in columns instead of in rows.

Once a horizontal or a vertical edge is detected, the ink value of the center pixel in the window is replaced by a convenient average of the ink values on the edge. As an example of finding such a convenient average of ink values on a horizontal edge, the ink values of ink pixels darker than T_(dark) in the middle row are summed and the sum is divided by N. Other averaging techniques can be used.

Following is an example of a preferred embodiment of the invention, wherein T_(dark)=175, and 8-bit printing is assumed. Table A herein below is a 3×7 window of ink and background pixels that is input to the herein claimed invention. The ink pixels and the background pixels are subsequently binarized. That is, each pixel is identified as zero (0) to denote it is a background pixel or as one (1) to denote it is an ink pixel, using T_(dark) as the threshold criteria to distinguish between ink and background pixels. Table B herein below depicts the respective ink and background binary values for the pixels in Table A. TABLE A 230 240 34 192 199 222 210 71 201 54 44 223 231 20 34 45 55 21 220 17 33

TABLE B 1 1 0 1 1 1 1 0 1 0 0 1 1 0 0 0 0 0 1 0 0

Table B shows that the top row is identified as dark because it has six (6), or greater than or equal to N-n ink pixels, and wherein the single outlying pixel (the third pixel) is not located in the central column. Table B shows that the bottom row as light. The middle row is therefore identified as a horizontal edge and the ink value of the center pixel of the window is replaced by: (201+223+231)/7=93. Slanted Edge Smoothing and Hole Mending/Dot Removal

In the preferred embodiment, each pixel has a 3×3 neighborhood that is considered. The region is binarized into ink and background pixels using the threshold T_(dark). For each pattern of nine (9) ink or background pixels in the window, a smoothing level is assigned with values ranging from zero (0) to three (3). The ink value of the center pixel is then modified in accordance to this smoothing level, which is also described in Table C herein below. TABLE C Class of Center Pixel Ink Background Smoothing Level 0 no change no change 1 reduce ink by 255-ink increase ink by half of 255-ink 2 reduce ink by twice of increase ink by 2/3 of 255-ink 255-ink 3 replace ink by 15 replace ink by 235

The distinct ink and background patterns in the preferred embodiment and their corresponding smoothing levels, herein also referred to as jaggy levels, are given in Table D herein below. Patterns that are related to one another through a rotation or a reflection are assigned the same smoothing level. Only one of them is listed herein below in Table D. Furthermore, this list in Table D only shows those cases wherein the center pixel is an ink pixel. The smoothing level of the center pixel when it is a background pixel can be deduced from the binary complement of the list given in Table D. TABLE D (0 = background, 1 = ink) Level 0 111 111 111 111 111 111 111 111 110 111 111 111 111 011 111 011 011 011 010 111 111 011 010 011 111 111 011 011 101 110 111 010 011 100 110 010 110 011 111 110 110 110 111 110 110 101 011 010 011 011 010 011 011 111 010 010 011 011 011 011 011 011 101 101 110 010 100 110 100 100 100 110 011 111 011 110 010 000 000 001 000 001 001 001 010 010 011 011 111 110 111 110 111 110 110 010 110 010 010 001 010 011 001 100 010 010 001 101 000 000 000 001 110 110 111 010 010 001 000 100 Level 1 111 111 101 000 000 000 000 011 011 010 110 110 010 110 001 000 101 110 101 100 100 Level 2 100 000 000 110 110 010 100 000 101 Level 3 000 010 000

FIG. 4 is a flow diagram of a first main procedure 31 that performs horizontal and vertical edge smoothing on a pixel from a text enhancement system according to the preferred embodiment of the invention. The method centers a 3×7 window and a 7×3 window on a current pixel 401. The method then determines if the current pixel is a text enhanced or a neighbor to a text enhanced pixel 402. If it is not, then the method goes to the next pixel 403.

If the current pixel is a text enhanced or a neighbor to a text enhanced pixel, then the method examines the top or bottom row of the 3×7 window and determines if there is at most one dark pixel exceeding T_(dark), wherein the dark pixel is not the middle pixel 404. If there is at most one dark pixel, wherein the dark pixel is not the middle pixel, then the method examines the other top or bottom row of the 3×7 window and determines if there is at most one light pixel less than T_(dark), wherein the light pixel is not the middle pixel 405. If there is at most one light pixel, wherein the light pixel is not the middle pixel, the method then sets the ink value of the current pixel to an average of the ink values of the middle row 406. The method then goes to the next pixel 407.

If there is not at most one light pixel, wherein the light pixel is not the middle pixel, or if there is not at most one dark pixel, wherein the dark pixel is not the middle pixel, then the method examines the right or left column of the 7×3 window and determines if there is at most one dark pixel, wherein the dark pixel is not the middle pixel 408. If there is at most one dark pixel, wherein the dark pixel is not the middle pixel, then the method examines the other right or left column of the 7×3 window and determines if there is at most one light pixel, wherein the light pixel is not the middle pixel 409. If there is at most one light pixel, wherein the light pixel is not the middle pixel, the method sets the ink value of the current pixel to an average of the ink values of the middle column 410 and goes to the next pixel 407.

If there is not at most one dark pixel, wherein the dark pixel is not the middle pixel 408, or if there is not at most one light pixel, wherein the light pixel is not the middle pixel 409, the method goes on to a second main procedure that performs slanted edge smoothing, and hole mending and dot removal 411 described herein below.

FIG. 5 is a flow diagram of a second main procedure 32 that performs slanted edge smoothing, and hole mending and dot removal according to the preferred embodiment of the invention. The method centers a 3×3 window at the current pixel 501. Then the method finds the pattern number of the light and dark pixels pattern in the 3×3 window 502. The method then determines the jaggy level for the pattern from a look-up conversion table 503. The look-up conversion table's contents are jaggy levels, which herein are zero (0), one (1), two (2), and three (3). It is noted that the look-up conversion table cited herein can be created by empirical trial and error methods. The method then modifies the ink value of the current pixel according to the jaggy level 504. The method then ends 505.

Accordingly, although the invention has been described in detail with reference to particular preferred embodiments, persons possessing ordinary skill in the art to which this invention pertains will appreciate that various modifications and enhancements may be made without departing from the spirit and scope of the claims that follow. 

1. A method for smoothing a jagged outline of a text image, the method comprising: locating horizontal and vertical edges of the text image; smoothing the horizontal and vertical edges; locating slanted edges of the text image; and smoothing the slanted edges. 